//
// CPreviewAdmin.h
//

#ifndef __H_CPreviewAdmin__
#define __H_CPreviewAdmin__

class CDXGraph;
class CDXFilter;
class CAVDevice;
class CVideoWindow;
class CPreviewAdmin
{
protected:
	CDXGraph *		mGraph;
	CVideoWindow *	mVideoWindow;
	CAVDevice *		mVideoDevice;
	CAVDevice *		mAudioDevice;
	
	// Filters
	CDXFilter *		mVideoFilter;
	CDXFilter *		mAudioFilter;
	CDXFilter *		mVideoRenderer;
	CDXFilter *		mAudioRenderer;

public:
	CPreviewAdmin();
	virtual ~CPreviewAdmin();

	void SetAVDevice(CAVDevice * inVideo, CAVDevice * inAudio);
	void SetVideoWindow(CVideoWindow * inWindow);

	virtual BOOL Activate(void);
	virtual void Deactivate(void);

	BOOL PlayGraph(void);
	BOOL PauseGraph(void);
	virtual BOOL StopGraph(void);

	CDXFilter * GetVideoInputFilter(void) {return mVideoFilter;}
	CDXFilter * GetAudioInputFilter(void) {return mAudioFilter;}

	void ShowVideoCapturePropertyPage(void);
	void ShowAudioCapturePropertyPage(void);

protected:
	virtual BOOL CreateGraph(void);
	virtual void DeleteGraph(void);

	virtual BOOL CreateInputFilters(void);
	virtual void ReleaseInputFilters(void);

	virtual BOOL CreateOutputFilters(void);
	virtual void ReleaseOutputFilters(void);

	virtual BOOL ConnectFilters(void);
	virtual BOOL AfterBuildGraph(void);

	// Utilities
	BOOL RenderDVVideo(CDXGraph * inGraph, IPin * inDVPin, IPin * inRenderedPin);
};

#endif // __H_CPreviewAdmin__